package 历年真题;

import java.util.HashSet;
import java.util.Set;

public class q21 {

	private static boolean check(char[] ch){
		Set<Character> set = new HashSet<Character>();
		for(int i=0;i<ch.length;i++){
			set.add(ch[i]);
		}
		if(set.size() == 5){
			return true;
		}
		return false;
	}
	
	private static boolean checkReverise(char[] orign,int change){
		
		char[] ch = String.valueOf(change).toCharArray();
		if(ch.length>5){
			return false;
		}
		
		for(int i=0;i<5;i++){
			if(orign[i] != ch[4-i]){
				return false;
			}
		}
		
		return true;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		for(int i=10000;i<99999;i++){
			char[] ch = String.valueOf(i).toCharArray();
			if(check(ch)){
			 for(int j=1;j<10;j++){
				if(checkReverise(ch,i*j)){
					System.out.println(i);
					System.out.println(i*j);
					return;
				}
			 }
			}
		}
	}

}
